package cn.jingzhuan.fm.di.component

import cn.jingzhuan.fm.mvp.contract.FMAudioContract
import cn.jingzhuan.fm.mvp.contract.FMAudioDocumentContract
import cn.jingzhuan.fm.ui.activity.FMAudioActivity
import cn.jingzhuan.fm.ui.activity.FMAudioDocumentActivity
import dagger.Module
import dagger.Provides
import dagger.Subcomponent
import dagger.android.AndroidInjector


@Subcomponent(modules = [(FMAudioDocumentModule::class)])
interface FMAudioDocumentComponent : AndroidInjector<FMAudioDocumentActivity> {

    @Subcomponent.Builder
    abstract class Builder : AndroidInjector.Builder<FMAudioDocumentActivity>() {
        abstract fun newModule(module : FMAudioDocumentModule):Builder

        override fun seedInstance(instance: FMAudioDocumentActivity) {
            newModule(FMAudioDocumentModule(instance))
        }
    }
}

@Module
class FMAudioDocumentModule(val mView: FMAudioDocumentContract.View) {
    @Provides
    fun getView() = mView
}
